/** @jsxImportSource @emotion/react */
import * as React from "react";
import {
  CCell, Cell, Table, TableBody, TableRow, Text,
} from "customize-easy-ui-component";
import {DirectLink} from "../../../routing/Link";
import {config资料审查, } from "./editReview";
import {usePrefixDataTable} from "../../hook/usePrefixData";
import {TailMenRowIspCheck} from "../../contain/rarelyVary";

//拆分成2个编辑器的
const config资料审查上=config资料审查.slice(0, 14);
const config资料审查下=config资料审查.slice(14);
export const 资料审查报告= ({theme, orc, rep} :{theme: any, orc:any, rep:any}
) => {
  //【表格助手】  JSON.parse(orc?._tblFixed??'[]')  ; 【制表工具】  直接替换目标表的fixed字段 ：动态开发测试的
  const renderUpper=usePrefixDataTable({config: config资料审查上, orc, rep, slash:true});
  const renderMiddle=usePrefixDataTable({config: config资料审查下, orc, rep, slash:true,
      embed: { 0:  <CCell split rowSpan={8}>性能参数</CCell>,  },
  });
  return <>
    <div css={{"@media print": {paddingBottom: '4rem', pageBreakInside: 'avoid'}} }>
      <Text id='MaterialReview' variant="h2" css={{
        textAlign: 'center', marginTop: '1rem',
      }}>移动式压力容器资料审查报告</Text>
      <div css={{
        display: 'flex',
        justifyContent: 'space-between'
      }}>
        <Text></Text>
        <Text>报告编号：{rep.isp.no}</Text>
      </div>
    </div>
    <Table  fixed={ ["4.2%","12.1%","39%","9%","11.1%","%"] }  tight  miniw={800}
                        css={ {borderCollapse: 'collapse', "@media print": {marginTop: '-4rem'}} } >
      <TableBody>
        <DirectLink  href={`/report/${rep?.modeltype}/ver/${rep?.modelversion}/${rep?.id}/MaterialReview#MaterialReview`}>
          {renderUpper}
        </DirectLink>
      </TableBody>
    </Table>
    <Table  fixed={ ["4.2%","4%","8.2%","38.8%","4%","16.3%","%"] }  css={ {borderCollapse: 'collapse', } }  tight  miniw={800}>
      <TableBody>
        <DirectLink  href={`/report/${rep?.modeltype}/ver/${rep?.modelversion}/${rep?.id}/MaterialReview#MaterialReview`}>
          {renderMiddle}
        </DirectLink>
      </TableBody>
    </Table>
    <Table  fixed={ ["8.1%",  "%"] } css={ {borderCollapse: 'collapse' } } tight  miniw={800}>
      <TableBody>
        <DirectLink  href={`/report/${rep?.modeltype}/ver/${rep?.modelversion}/${rep?.id}/PreviousQuestion#PreviousQuestion`}>
          <TableRow>
            <CCell>资料审查</CCell>
            <Cell split={true} colSpan={4}><div css={{minHeight: '3rem', whiteSpace: 'pre-wrap'}}>
              {orc.资料审查 || '／'}
            </div></Cell>
          </TableRow>
          <TableRow>
            <CCell>上次定期检验问题记载</CCell>
            <Cell split={true} colSpan={4}><div css={{minHeight: '3rem', whiteSpace: 'pre-wrap'}}>
              {orc.上次缺处 || '／'}
            </div></Cell>
        </TableRow>
        </DirectLink>
      </TableBody>
    </Table>
    <TailMenRowIspCheck orc={orc} rep={rep} />
  </>;
};

